class MagicDictionary {

    private String[] words;
    /** Initialize your data structure here. */
    public MagicDictionary() {

    }
    
    public void buildDict(String[] dictionary) {
        words = dictionary;
    }
    
    public boolean search(String searchWord) {
        for(String word:words) {
            if(word.length() != searchWord.length()) {
                continue;
            }
            int ret = 0;
            for(int i = 0;i < word.length();i++) {
                if(word.charAt(i) != searchWord.charAt(i)) {
                    ret++;
                    if(ret > 1) {
                        break;
                    }
                }
            }
            if(ret == 1) {
                return true;
            }
        }
        return false;
    }
}

/**
 * Your MagicDictionary object will be instantiated and called as such:
 * MagicDictionary obj = new MagicDictionary();
 * obj.buildDict(dictionary);
 * boolean param_2 = obj.search(searchWord);
 */